package ioc;

import material.Material;
import model.Constants;
import commands.Command;

public class CheckableWheelImpl implements CheckableWheel {

	private Command command;
	private float currentPosition;
	
	public CheckableWheelImpl(float position) {
		currentPosition = position;
	}
	
	public void setCommand(Command command) {
		this.command = command;
	}

	public float getCurrentPosition() {
		return currentPosition;
	}
	
	public void check() {
		float newPosition = Material.MaterielInstance().getMolette().position();
		if(newPosition != currentPosition) {
			command.execute();
		}
		currentPosition = newPosition;
	}
	
}
